package com.itheima.leyou.controller;

import com.itheima.leyou.service.StorageService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
public class StorageController {

    @Resource
    StorageService storageService;

    @RequestMapping(value = "/getStockStorage/{sku_id}")
    public Map<String, Object> getStockStorage(@PathVariable("sku_id") String sku_id){
        return storageService.getStockStorage(sku_id);
    }

    @RequestMapping(value = "/insertStorage/{sku_id}/{in_quanty}/{out_quanty}")
    public Map<String, Object> insertStorage(@PathVariable("sku_id") String sku_id, @PathVariable("in_quanty") double in_quanty,
                                             @PathVariable("out_quanty") double out_quanty){
        return storageService.insertStorage(sku_id, in_quanty, out_quanty);
    }
}
